package com.devoteam.quickaction;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;

//clearInfo();
//String displayName = contact.getDisplayName();
//SpannableStringBuilder ssb = new SpannableStringBuilder(displayName);
//if (filterSequence != null && !filterSequence.equals("")) {
//	int start = displayName.indexOf(filterSequence);
//	int end = start + filterSequence.length();
//	ssb.setSpan(new ForegroundColorSpan(Color.GREEN), start, end, Editable.SPAN_INCLUSIVE_INCLUSIVE);
//}
//mLabel.setText(ssb);
//if (contact.getPhoto() != null) {
//	mBadge.setImageDrawable(new BitmapDrawable(getResources(), contact.getPhoto()));
//} else {
//	mBadge.setImageResource(PIC_DEF);
//}
//Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contact.id);
//mBadge.assignContactUri(contactUri);

public class QuickActionBadge extends ImageView{
	
	private int mId;//TODO
	
	public QuickActionBadge(Context context) {
		super(context);
	}
	
	public QuickActionBadge(Context context, AttributeSet attSet){
		super(context, attSet);
	}
	
	public QuickActionBadge(Context context, AttributeSet attSet, int defStyle){
		super(context, attSet, defStyle);
	}
	
	public void setData(int contactId, int phones, int emails){
		mId = contactId;
		List<QuickItem> items = new ArrayList<QuickItem>();
		if(contactId>0){
			items.add(new QuickItem(R.drawable.qcb_ic_info, 0, new OnClickListener() {
				@Override
				public void onClick(View v) {
					//TODO onInfo
				}
			}));
			if(phones>0){
				//call
				//sms
				items.add(new QuickItem(R.drawable.qcb_ic_call, 0, new OnClickListener() {
					@Override
					public void onClick(View v) {
						//TODO onCall
					}
				}));
				items.add(new QuickItem(R.drawable.qcb_ic_sms, 0, new OnClickListener() {
					@Override
					public void onClick(View v) {
						//TODO onSms
					}
				}));
			}
			if(emails>0){
				items.add(new QuickItem(R.drawable.qcb_ic_email, 0, new OnClickListener() {
					@Override
					public void onClick(View v) {
						//TODO onEmail
					}
				}));
			}
		}
		QuickActionWindow.setAction(this, items);
	}
}
